{"ast":null,"code":"import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport CSSMotion from 'rc-motion';\nimport { getMotion } from \"../utils/motionUtil\";\nimport MenuContextProvider, { MenuContext } from \"../context/MenuContext\";\nimport SubMenuList from \"./SubMenuList\";\nexport default function InlineSubMenuList(_ref) {\n  var id = _ref.id,\n    open = _ref.open,\n    keyPath = _ref.keyPath,\n    children = _ref.children;\n  var fixedMode = 'inline';\n  var _React$useContext = React.useContext(MenuContext),\n    prefixCls = _React$useContext.prefixCls,\n    forceSubMenuRender = _React$useContext.forceSubMenuRender,\n    motion = _React$useContext.motion,\n    defaultMotions = _React$useContext.defaultMotions,\n    mode = _React$useContext.mode; // Always use latest mode check\n\n  var sameModeRef = React.useRef(false);\n  sameModeRef.current = mode === fixedMode; // We record `destroy` mark here since when mode change from `inline` to others.\n  // The inline list should remove when motion end.\n\n  var _React$useState = React.useState(!sameModeRef.current),\n    _React$useState2 = _slicedToArray(_React$useState, 2),\n    destroy = _React$useState2[0],\n    setDestroy = _React$useState2[1];\n  var mergedOpen = sameModeRef.current ? open : false; // ================================= Effect =================================\n  // Reset destroy state when mode change back\n\n  React.useEffect(function () {\n    if (sameModeRef.current) {\n      setDestroy(false);\n    }\n  }, [mode]); // ================================= Render =================================\n\n  var mergedMotion = _objectSpread({}, getMotion(fixedMode, motion, defaultMotions)); // No need appear since nest inlineCollapse changed\n\n  if (keyPath.length > 1) {\n    mergedMotion.motionAppear = false;\n  } // Hide inline list when mode changed and motion end\n\n  var originOnVisibleChanged = mergedMotion.onVisibleChanged;\n  mergedMotion.onVisibleChanged = function (newVisible) {\n    if (!sameModeRef.current && !newVisible) {\n      setDestroy(true);\n    }\n    return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);\n  };\n  if (destroy) {\n    return null;\n  }\n  return /*#__PURE__*/React.createElement(MenuContextProvider, {\n    mode: fixedMode,\n    locked: !sameModeRef.current\n  }, /*#__PURE__*/React.createElement(CSSMotion, _extends({\n    visible: mergedOpen\n  }, mergedMotion, {\n    forceRender: forceSubMenuRender,\n    removeOnLeave: false,\n    leavedClassName: \"\".concat(prefixCls, \"-hidden\")\n  }), function (_ref2) {\n    var motionClassName = _ref2.className,\n      motionStyle = _ref2.style;\n    return /*#__PURE__*/React.createElement(SubMenuList, {\n      id: id,\n      className: motionClassName,\n      style: motionStyle\n    }, children);\n  }));\n}","map":{"version":3,"names":["_extends","_objectSpread","_slicedToArray","React","CSSMotion","getMotion","MenuContextProvider","MenuContext","SubMenuList","InlineSubMenuList","_ref","id","open","keyPath","children","fixedMode","_React$useContext","useContext","prefixCls","forceSubMenuRender","motion","defaultMotions","mode","sameModeRef","useRef","current","_React$useState","useState","_React$useState2","destroy","setDestroy","mergedOpen","useEffect","mergedMotion","length","motionAppear","originOnVisibleChanged","onVisibleChanged","newVisible","createElement","locked","visible","forceRender","removeOnLeave","leavedClassName","concat","_ref2","motionClassName","className","motionStyle","style"],"sources":["/Users/poppie/Desktop/development/messenger/app/frontend/node_modules/rc-menu/es/SubMenu/InlineSubMenuList.js"],"sourcesContent":["import _extends from \"@babel/runtime/helpers/esm/extends\";\nimport _objectSpread from \"@babel/runtime/helpers/esm/objectSpread2\";\nimport _slicedToArray from \"@babel/runtime/helpers/esm/slicedToArray\";\nimport * as React from 'react';\nimport CSSMotion from 'rc-motion';\nimport { getMotion } from \"../utils/motionUtil\";\nimport MenuContextProvider, { MenuContext } from \"../context/MenuContext\";\nimport SubMenuList from \"./SubMenuList\";\nexport default function InlineSubMenuList(_ref) {\n  var id = _ref.id,\n      open = _ref.open,\n      keyPath = _ref.keyPath,\n      children = _ref.children;\n  var fixedMode = 'inline';\n\n  var _React$useContext = React.useContext(MenuContext),\n      prefixCls = _React$useContext.prefixCls,\n      forceSubMenuRender = _React$useContext.forceSubMenuRender,\n      motion = _React$useContext.motion,\n      defaultMotions = _React$useContext.defaultMotions,\n      mode = _React$useContext.mode; // Always use latest mode check\n\n\n  var sameModeRef = React.useRef(false);\n  sameModeRef.current = mode === fixedMode; // We record `destroy` mark here since when mode change from `inline` to others.\n  // The inline list should remove when motion end.\n\n  var _React$useState = React.useState(!sameModeRef.current),\n      _React$useState2 = _slicedToArray(_React$useState, 2),\n      destroy = _React$useState2[0],\n      setDestroy = _React$useState2[1];\n\n  var mergedOpen = sameModeRef.current ? open : false; // ================================= Effect =================================\n  // Reset destroy state when mode change back\n\n  React.useEffect(function () {\n    if (sameModeRef.current) {\n      setDestroy(false);\n    }\n  }, [mode]); // ================================= Render =================================\n\n  var mergedMotion = _objectSpread({}, getMotion(fixedMode, motion, defaultMotions)); // No need appear since nest inlineCollapse changed\n\n\n  if (keyPath.length > 1) {\n    mergedMotion.motionAppear = false;\n  } // Hide inline list when mode changed and motion end\n\n\n  var originOnVisibleChanged = mergedMotion.onVisibleChanged;\n\n  mergedMotion.onVisibleChanged = function (newVisible) {\n    if (!sameModeRef.current && !newVisible) {\n      setDestroy(true);\n    }\n\n    return originOnVisibleChanged === null || originOnVisibleChanged === void 0 ? void 0 : originOnVisibleChanged(newVisible);\n  };\n\n  if (destroy) {\n    return null;\n  }\n\n  return /*#__PURE__*/React.createElement(MenuContextProvider, {\n    mode: fixedMode,\n    locked: !sameModeRef.current\n  }, /*#__PURE__*/React.createElement(CSSMotion, _extends({\n    visible: mergedOpen\n  }, mergedMotion, {\n    forceRender: forceSubMenuRender,\n    removeOnLeave: false,\n    leavedClassName: \"\".concat(prefixCls, \"-hidden\")\n  }), function (_ref2) {\n    var motionClassName = _ref2.className,\n        motionStyle = _ref2.style;\n    return /*#__PURE__*/React.createElement(SubMenuList, {\n      id: id,\n      className: motionClassName,\n      style: motionStyle\n    }, children);\n  }));\n}"],"mappings":"AAAA,OAAOA,QAAQ,MAAM,oCAAoC;AACzD,OAAOC,aAAa,MAAM,0CAA0C;AAC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